<template>
	<div>
		<div class="header">
			<div class="icon-left" @click="$router.goBack()"><img src="../../static/img/icon/release_icon/return@2x.png"/></div>
			<div>分享</div>
			<div style="width: 40px;"></div>
		</div>
		<!--<div class="header-null"></div>-->
		<iframe :src="srcs"></iframe>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				srcs: ''
			}
		},
		mounted() {
			if(this.$route.query.type == 'weibo') { //分享微博
				const share = {
				    title: '分享标题',
				    image_url: '图片URL',
				    share_url: '分享链接'
				};
				this.srcs = 'https://service.weibo.com/share/share.php?url=' + encodeURIComponent(share.share_url) + '&title=' + share.title + '&appkey=277159429&&ralateUid=1855112015&pic=' + share.image_url + '&searchPic=true';
			} else if(this.$route.query.type == 'qzone') {   //分享qq空间
				const share = {
				    title: '分享标题',
				    desc: '分享内容',
				    image_url: ['图片URL'],
				    share_url: '分享链接'
				};
				let image_urls = share.image_url.map(function(image) {
				    return encodeURIComponent(image);
				});
				this.srcs = 'https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=' + encodeURIComponent(share.share_url) + '&site=掌上理工大&title=' + share.title + '&pics=' + image_urls.join('|') + '&summary=' + share.desc;
			}
			$('iframe').scrollTop(0)
		}
	}
</script>

<style>
</style>